package com.jiangyg.mall.admin.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jiangyg.mall.admin.entity.Permission;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 类描述：权限
 *
 * @author jiangyg
 * @date 2021-10-17
 */
@Mapper
public interface PermissionDao extends BaseMapper<Permission> {

    /**
     * 功能描述：根据关联ID查询所有的权限资源ID
     *
     * @param referenceId 关联ID
     * @return 权限资源ID
     */
    @Select("select resource_id from t_sys_permission where reference_id = #{referenceId} and enable = 'Y'")
    List<String> selectResourceIdsByReferenceId(@Param("referenceId") Long referenceId);

}
